function [x,k] = jacobi(A, b, error,m ,x)
	
	N = rows(A);
	k = 0; 
	sum = 0;
	norma = 1;
	
	if det(A) != 0
		while (abs(norma) > error) && (k < m)
		
			x0 = x;
			for i =  1 : N
				sum  = 0;
				for j =  1: N
					if i !=  j
						sum = sum + A(i,j)* x(j);
					endif
				endfor	
				x(i) = (b(i)-sum)/ A(i,i);
			endfor
			
			norma = norm(x-x0,inf);
			k = k + 1;
	
		endwhile
	else
		fprintf('ERROR, la matriz ingresada es singular!!, pruebe con otra\n')
    endif


endfunction